package org.persistente.xml;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 *
 * @author philipe
 */
public class TimestampParser extends FieldParser<Timestamp> {

    @Override
    public Timestamp parse(String value) {
        try {
            DateFormat d = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
            java.util.Date data;
            data = d.parse(value.substring(0, 22) + "00");
            return new Timestamp(data.getTime());   
        } catch (ParseException ex) {
            return null;
        }           
    }    
}
